<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var str = 'qweqwwwwwwwwwerqqwerqweqr'

    var obj = {}

    for(var i = 0; i < str.length; i++) {
      if( obj[ str[i] ] ) {
        obj[ str[i] ] += 1
      } else {
        obj[ str[i] ] = 1
      }
    }

    var max = 0
    var maxVal = ''
    for(var key in obj) {
      if( max < obj[key] ) {
        max = obj[key]
        maxVal = key
      }
    }

    console.log( '出现最多次数的是' + maxVal + '出现了' + max )


  </script>
</body>
</html>